package com.supermali.entity.npc.finish;

import com.supermali.behavior.glide.DefaultGlideBehavior;
import com.supermali.behavior.glide.GlideBehavior;
import com.supermali.creater.MapCreater;
import com.supermali.creater.img.ImgHelper;
import com.supermali.creater.img.ImgKey;
import com.supermali.creater.img.ImgLoader;

import java.awt.image.BufferedImage;

/**
 * @project runner
 * @Date 2021/3/18
 * @Auth yangrui
 * 旗杆
 **/
public class WhiteFlagFinish extends FinishAbstract {

    public WhiteFlagFinish(Double x, Double y, MapCreater mapCreater) {
        super(x, y, mapCreater);
    }

    GlideBehavior glideBehavior;

    @Override
    public void finish() {
        glideBehavior.startGlide(this);
    }

    @Override
    public void proccessData(long delta) {
        glideBehavior.glide(delta);
    }

    @Override
    public void init() {
        ImgHelper imgHelper = ImgLoader.getImgHelper(ImgKey.Background.WHITE_FLAG);
        BufferedImage select = imgHelper.select(0);
        this.setBufferedImage(select);
        glideBehavior = new DefaultGlideBehavior(this);
    }
}
